package main

import (
    "fmt"
    "net"
    "time"
)

func startSlave() {
    conn, err := net.Dial("tcp", config.SlaveAddr)
    if err != nil {
        fmt.Println("Error connecting to slave:", err)
        return
    }
    defer conn.Close()

    fmt.Println("Connected to slave on", config.SlaveAddr)

    for {
        sendIEC104Message(conn, IEC104Message{Type: "C", Data: "01", AuthKey: generateAuthKey("01", config.AuthKey)})
        time.Sleep(5 * time.Second)
    }
}